package com.blockchainenergy.info.node;

import com.blockchainenergy.common.Result;
import com.blockchainenergy.info.line.LineInfo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @descriptions:
 * @data: 2021/10/23 12:31
 */

@RestController //本注解说明本类对象为spring容器管理的对象，并且说明这是一个控制器组件
@RequestMapping("/info/node")//本注解说明本控制器所有路径都以。。。开头
public class NodeAPI {

    @Resource
    private NodeService nodeService;

    @GetMapping("/getNodes")
    public Result getNodes() throws Exception {
        return Result.success(nodeService.getNodes());
    }

    @GetMapping("/getNodeInfoById")
    public Result getNodeInfoById(@RequestParam Integer i) throws Exception {
        return Result.success(new NodeInfo(i));
    }
}
